package com.lindenvalley.ch.parser;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class AbstractXmlParser {
	
	protected static final String SET = "set";
	private final Pattern pattern = Pattern.compile("&#[0-9]{3}");
	
	protected String decodeFromHtml(String inputString){
		StringBuilder sb = new StringBuilder(inputString);
		Matcher matcher = pattern.matcher(inputString);
		while (matcher.find()){
			  String str = matcher.group();
			  char value = (char)Integer.parseInt(str.substring(2));
			  int index = sb.indexOf(str);
			  sb.replace(index, index + str.length(), String.valueOf(value));			  
		  }
		return sb.toString();
		
	}

}
